<template>
    <template v-if="istrim">
        <el-input
            v-model.trim="formData[$attrs.prop]"
            v-bind="$attrs"
            :placeholder="placeholder"
            :clearable="clearable"
            @input="doInput"
        ></el-input>
    </template>
    <template v-else>
        <el-input
            v-model="formData[$attrs.prop]"
            v-bind="$attrs"
            :placeholder="placeholder"
            :clearable="clearable"
            @input="doInput"
        ></el-input>
    </template>
</template>

<script>
export default {
    props: {
        formData: {
            type: Object,
            default: () => ({})
        },
        onInput: {
            type: [Function, undefined],
            default: undefined
        },
        placeholder: {
            type: String,
            default: '请输入'
        },
        clearable: {
            type: Boolean,
            default: true
        },
        istrim: {
            type: Boolean,
            default: true
        }
    },
    methods: {
        doInput(e) {
            if (this.onInput) {
                this.onInput(e)
            }
        }
    }
}
</script>

<style></style>
